using System;
using System.Data;

namespace FreeFlow.Administration
{
	/// <summary>
	/// A report.
	/// </summary>
	public class Report : DatabaseAware
	{
    private string sql;
    /// <summary>
    /// Initializes a new instance of the <see cref="Report"/> class.
    /// </summary>
    /// <param name="server">The server.</param>
    /// <param name="name">The name of the report.</param>
    /// <param name="sql">The SQL used to generate the report.</param>
    /// <param name="description">The description of the report.</param>
		public Report(Server server, string name, string sql, string description) : base(server)
		{
      this.name = name;
      this.sql = sql;
      this.description = description;
		}

    private string name;
    /// <summary>
    /// Gets the name of the report.
    /// </summary>
    public string Name
    {
      get
      {
        return name;
      }
    }

    private string description;
    /// <summary>
    /// Gets the description of this report.
    /// </summary>
    public string Description
    {
      get
      {
        return description;
      }
    }

    /// <summary>
    /// Gets the result data table for this report.
    /// </summary>
    public DataTable ResultsDataTable
    {
      get
      {
        return Server.ExecuteDataTable(sql);
      }
    }
	}
}
